import time
from selenium.webdriver.common.by import By
from selenium import webdriver

driver = webdriver.Edge()
time.sleep(2)
driver.get('https://www.baidu.com')
# driver.find_element(By.XPATH,'//*[@id="kw"]').send_keys('1')
# driver.find_element(By.Id,'kw').send_keys('2')
# driver.find_element(By.NAME,'wd').send_keys('3')
# driver.find_element(By.XPATH,'/html/body/div/div[2]/div[5]/div[1]/div/form/span[1]/input').send_keys('4')
# driver.find_element(By.CSS_SELECTOR,'input#kw.s_ipt').send_keys('5')
# driver.find_element(By.CSS_SELECTOR,'.s_ipt').send_keys('6')
# time.sleep(3)
# driver.find_element(By.LINK_TEXT,'新闻').click()
# time.sleep(2)
# driver.switch_to.window(driver.window_handles[-1])
# driver.find_element(By.PARTIAL_LINK_TEXT,'小树苗').click()
# driver.switch_to.window(driver.window_handles[-1])
# time.sleep(2)
# # 滚动到任意像素
# driver.execute_script("window.scrollTo(0,800)")
# time.sleep(2)
# # 滚动到顶部
# driver.execute_script("window.scrollTo(0,0)")
# time.sleep(2)
# # 滚动到底部
# driver.execute_script("window.scrollTo(0,document.body.scrollHeight)")
# time.sleep(10)

